function CRMPanel_Code() {
	var date=new Date();
	var year=date.getFullYear();
	var month=date.getMonth()+1;
	var buffer = new StringBuffer();
	buffer.append('<div id="content" class="content" style="margin-top: 0px;">');
	buffer.append('<div class="smalltitle">全部应用 (长按可以加入到常用哦，试试吧)</div>');
	buffer.append('<div class="often border-top-bottom allapp">');
	if(User.CRM_Menu.indexOf(",9,")>-1 && User.RolePower.indexOf(",9,")>-1) buffer.append('<div val="9" class="line" tablename="客户"><div class="icon"><img src="img/customer.png"/></div><div class="name">客户</div></div>');
	if(User.CRM_Menu.indexOf(",30,")>-1 && User.RolePower.indexOf(",30,")>-1) buffer.append('<div val="30" class="line" tablename="客户查重"><div class="icon"><img src="img/customersearch.png"/></div><div class="name">客户查重</div></div>');
	if(User.CRM_Menu.indexOf(",31,")>-1 && User.RolePower.indexOf(",31,")>-1) buffer.append('<div val="31" class="line" tablename="附近客户"><div class="icon"><img src="img/customernear.png"/></div><div class="name">附近客户</div></div>');
	if(User.CRM_Menu.indexOf(",32,")>-1 && User.RolePower.indexOf(",32,")>-1) buffer.append('<div val="32" class="line" tablename="公海客户"><div class="icon"><img src="img/highsea.png"/></div><div class="name">公海客户</div></div>');
	if(User.CRM_Menu.indexOf(",33,")>-1 && User.RolePower.indexOf(",33,")>-1) buffer.append('<div val="33" class="line" tablename="销售目标"><div class="icon"><img src="img/goal.png"/></div><div class="name">销售目标</div></div>');
	if(User.CRM_Menu.indexOf(",10,")>-1 && User.RolePower.indexOf(",10,")>-1)buffer.append('<div val="10" class="line" tablename="联系人"><div class="icon"><img src="img/contacts.png"/></div><div class="name">联系人</div></div>');
	if(User.CRM_Menu.indexOf(",12,")>-1 && User.RolePower.indexOf(",12,")>-1) buffer.append('<div val="12" class="line" tablename="订单"><div class="icon"><img src="img/order.png"/></div><div class="name">订单</div></div>');
	if(User.CRM_Menu.indexOf(",13,")>-1 && User.RolePower.indexOf(",13,")>-1) buffer.append('<div val="13" class="line" tablename="合同"><div class="icon"><img src="img/contract.png"/></div><div class="name">合同</div></div>');
	if(User.CRM_Menu.indexOf(",11,")>-1 && User.RolePower.indexOf(",11,")>-1) buffer.append('<div val="11" class="line" tablename="产品"><div class="icon"><img src="img/product.png"/></div><div class="name">产品</div></div>');
	if(User.CRM_Menu.indexOf(",16,")>-1 && User.RolePower.indexOf(",16,")>-1) buffer.append('<div val="16" class="line" tablename="库存"><div class="icon"><img src="img/library.png"/></div><div class="name">库存</div></div>');
	if(User.CRM_Menu.indexOf(",34,")>-1 && User.RolePower.indexOf(",34,")>-1) buffer.append('<div val="34" class="line" tablename="采购管理"><div class="icon"><img src="img/purchase.png"/></div><div class="name">采购管理</div></div>');
	if(User.CRM_Menu.indexOf(",35,")>-1 && User.RolePower.indexOf(",35,")>-1) buffer.append('<div val="35" class="line" tablename="调拨"><div class="icon"><img src="img/movement.png"/></div><div class="name">调拨</div></div>');
	if(User.CRM_Menu.indexOf(",23,")>-1 && User.RolePower.indexOf(",23,")>-1) buffer.append('<div val="23" class="line" tablename="库位"><div class="icon"><img src="img/librarys.png"/></div><div class="name">库位</div></div>');
	if(User.CRM_Menu.indexOf(",17,")>-1 && User.RolePower.indexOf(",17,")>-1) buffer.append('<div val="17" class="line" tablename="供应商"><div class="icon"><img src="img/supplier.png"/></div><div class="name">供应商</div></div>');
	buffer.append('<div class="line" tablename="添加应用"><div class="icon"><img src="img/addapp.png"/></div><div class="name">添加应用</div></div>');
	
	buffer.append('</div>');
	buffer.append('<div class="crmreport">');
		buffer.append('<div class="monthtask">');
			buffer.append('<div class="titles"><div class="icon"><img src="img/monthtask.png"/></div><div class="name">本月指标</div><div id="settarget" class="set"><img src="img/gear6.png"/></div></div>');
			buffer.append('<div class="left">');
				buffer.append('<div class="line"><div id="zhuzi1" class="zhu">0%</div><div class="name">目标</div></div>');
				buffer.append('<div class="line"><div id="zhuzi2" class="zhu" style="background-color:#b5d763;">0%</div><div class="name">成交</div></div>');
				buffer.append('<div class="line"><div id="zhuzi3" class="zhu" style="background-color:#448aca;">0%</div><div class="name">回款</div></div>');
			buffer.append('</div>');
			buffer.append('<div class="right">');
				buffer.append('<div class="line"><div class="icon"><div class="small"></div></div><div class="name">目标</div></div>');
				buffer.append('<div class="money"><font id="targetmoney">0.00</font>元</div>');
				buffer.append('<div class="line"><div class="icon" style="background-color:#b5d763;"><div class="small"></div></div><div class="name">成交</div></div>');
				buffer.append('<div class="money"><font id="dismoney">0.00</font>元</div>');
				buffer.append('<div class="line"><div class="icon" style="background-color:#448aca;"><div class="small"></div></div><div class="name">回款</div></div>');
				buffer.append('<div class="money"><font id="backmoney">0.00</font>元</div>');
			buffer.append('</div>');
		buffer.append('</div>');
		
		buffer.append('<div class="monthreport">');
			buffer.append('<div class="titles"><div class="icon"><img src="img/monthreport.png"/></div><div class="name">本月简报</div></div>');
			buffer.append('<div class="list" val="1">');
				buffer.append('<div class="left"><img src="img/customer3.png"/></div>');
				buffer.append('<div class="right"><div class="num"><font id="customercount">0</font>个</div><div class="name">新增客户</div></div>');
			buffer.append('</div>');
			buffer.append('<div class="list" val="2">');
				buffer.append('<div class="left"><img src="img/contact3.png"/></div>');
				buffer.append('<div class="right"><div class="num"><font id="contactcount">0</font>个</div><div class="name">新增联系人</div></div>');
			buffer.append('</div>');
			buffer.append('<div class="list" val="3">');
				buffer.append('<div class="left"><img src="img/salerecord3.png"/></div>');
				buffer.append('<div class="right"><div class="num"><font id="salerecordcount">0</font>个</div><div class="name">新增销售记录</div></div>');
			buffer.append('</div>');
			buffer.append('<div class="list" val="4">');
				buffer.append('<div class="left"><img src="img/order3.png"/></div>');
				buffer.append('<div class="right"><div class="num"><font id="ordercount">0</font>个</div><div class="name">新增订单</div></div>');
			buffer.append('</div>');
			buffer.append('<div class="list" val="5">');
				buffer.append('<div class="left"><img src="img/contract3.png"/></div>');
				buffer.append('<div class="right"><div class="num"><font id="contractcount">0</font>个</div><div class="name">新增合同</div></div>');
			buffer.append('</div>');
			buffer.append('<div class="list" val="6">');
				buffer.append('<div class="left"><img src="img/payback.png"/></div>');
				buffer.append('<div class="right"><div class="num"><font id="payrecordcount">0</font>个</div><div class="name">新增回款</div></div>');
			buffer.append('</div>');
		buffer.append('</div>');
		
		buffer.append('<div class="monthrank">');
			buffer.append('<div class="titles"><div class="icon"><img src="img/rank.png"/></div><div class="name">'+month+'月销售榜</div><div id="calendar" class="calendar" year="'+year+'" month="'+month+'"><img src="img/calendar.png"/></div><div class="selectbar"><div class="bar select">个人</div><div class="bar">部门</div></div></div>');
			buffer.append('<div class="personrank">');
			buffer.append('</div>');
			buffer.append('<table>');
			buffer.append('</table>');
		buffer.append('</div>');
		
	buffer.append('</div>');
	buffer.append('</div>');
	return buffer.toString();
};

function FindCrmReport(){
	if($(".allapp").length==0)
	{
		return;		
	}
	var data = {};
		data.act = "Find_CRM_Report";
		data.userid = userid;
		data.comid = comid;
		data.source = source;  
		data.version = version;
		data.sign=GetSign(data.act);
		mui.getJSON(index_domain, data, function(json) {
		if (json.state) {
		   Show_SetTarget(json.data.targetmoney);
		   $("#targetmoney").html(json.data.targetmoney.toFixed(2));
		   $("#dismoney").html(json.data.dismoney.toFixed(2));
		   $("#backmoney").html(json.data.backmoney.toFixed(2));
		   $("#customercount").html(json.data.customercount);
		   $("#contactcount").html(json.data.contactcount);
		   $("#salerecordcount").html(json.data.salerecordcount);
		   $("#ordercount").html(json.data.ordercount);
		   $("#contractcount").html(json.data.contractcount);
		   $("#payrecordcount").html(json.data.payrecordcount);
	       if(json.data.targetmoney>0){
	       	$("#zhuzi1").css("height",parseFloat(json.data.targetmoney/json.data.maxmoney)*180+"px").html(100+"%");
	       	$("#zhuzi2").css("height",parseFloat(json.data.dismoney/json.data.maxmoney)*180+"px").html(parseInt(json.data.dismoney/json.data.targetmoney*100)+"%");
	       	$("#zhuzi3").css("height",parseFloat(json.data.backmoney/json.data.maxmoney)*180+"px").html(parseInt(json.data.backmoney/json.data.targetmoney*100)+"%");
	       }
		} else {
							            
		}
	});
	mui(".monthreport").on("tap",".list",function(){
		var index=$(this).attr("val");
		var date=new Date();
		var year=date.getFullYear();
		var month=date.getMonth()+1;
		var begindate=year+"-"+month+"-01";
		var enddate=year+"-"+month+"-"+DayNumOfMonth(year,month);
		if(index=="1")
		{
			myScroll1 = OpenScroll(1, "本月新增客户", "", function(pageindex) {
				Receive_Customer(pageindex, "",begindate,enddate,"createdate");
			}, function() {
			}, Customer_Code(), 70);
			Receive_Customer(1, "",begindate,enddate,"createdate");
			Init_Customer_Code();
		}else if(index=="2")
		{
			myScroll1 = OpenScroll(1,"本月新增联系人","",function(pageindex){
				Receive_Contact(pageindex,begindate,enddate);
			},function(){
									
			},Contact_Code(),70);
			Receive_Contact(1,begindate,enddate);
			Init_Contact_Code();
		}else if(index=="3")
		{
			myScroll1 = OpenScroll(1,"本月新增销售记录","",function(pageindex){
				Receive_SaleRecord(pageindex,begindate,enddate);
			},function(){
									
			},SaleRecord_Code(),70);
			Receive_SaleRecord(1,begindate,enddate);
			get("find").addEventListener("tap",function(){
				$("#searchicon").hide();
			    $("#searchicons").show();
			    $("#keyword").attr("placeholder","销售记录内容");
				if($("keyword").val()!="")
				{
					//WorkMate_Search();
				}
			});
		}else if(index=="4")
		{
			myScroll1 = OpenScroll(1,"本月新增订单","",function(pageindex){
				Receive_Order(pageindex,begindate,enddate);
			},function(){ 			
			},Order_Code(),70);		
			Receive_Order(1,begindate,enddate);
			Init_Order_Code();
		}else if(index=="5")
		{
			myScroll1 = OpenScroll(1,"本月新增合同","",function(pageindex){
				Receive_Contract(pageindex,begindate,enddate);
			},function(){ 				
			},Contract_Code(),70);
			Receive_Contract(1,begindate,enddate);
			Init_Contract_Code();
		}else if(index=="6")
		{
			myScroll1 = OpenScroll(1,"本月新增回款","",function(pageindex){
				Receive_PayRecord(pageindex,begindate,enddate);
			},function(){ 				
			},PayRecord_Code(),70);
			Receive_PayRecord(1,begindate,enddate);
		}
		
	});
};

function Show_SetTarget(money){
	if(money==0)
	{
		$("#settarget").show();
		get("settarget").addEventListener("tap",function(){
			OpenWindow2(2,"销售目标","设置",function(){
									if($("#thisyear").attr("money")=="")
									{
										return;
									}
									OpenWindow2(3,"设置目标","保存",function(){
										Set_SaleTarget();
									});
									$("#contentlist3").html(SaleTargetSet_Code());
								});
								$("#contentlist2").html(SaleTarget_Code());
								$("#button2").css("color","#666666");
								Init_SaleTarget();
		});
	}else
	{
		$("#settarget").hide();
	}
};

function PersonRank_Pager(year,month) {
    var data = {};
    data.act = "Find_RankOfUser";
    data.userid = userid;
	data.comid = comid;
	data.source = source;  
	data.version = version;
    data.pageindex = 1;
    data.pagesize = 10000;
    data.year = year;
    data.month = month;
    data.sign = GetSign(data.act);
    
    $(".monthrank table").html("<tr><td colspan='4'><div class='loading'><img src='img/loading.gif'/></div></td></tr>");
    mui.getJSON(oa_domain, data, function(json) {
    	var str="";
        str+='<tr><th width="15%">排名</th><th width="25%">姓名</th><th width="30%">部门</th><th width="30%" style="text-align:right;">回款金额</th></tr>';
        $.each(json.data,function(i,info){
        	str+='<tr><td width="15%"><div class="rank'+((i+1)<4?(i+1):4)+'">'+(i+1)+'</div></td><td width="25%">'+info.RealName+'</td><td width="30%">'+info.DepartName+'</td><td width="30%" style="text-align:right; color:green;">'+ info.ThisMonthBackMoney+'</td></tr>';
        });
        if(json.data.length==0)
        {
        	str="<tr><td colspan='4'><div class='loading'>主人，"+month+"月份销售榜单还没有产生</div></td></tr>";
        }
        $(".monthrank table").html(str);
        
        var name1="",headimg1="",name2="",headimg2="",name3="",headimg3="";
        if(json.data.length>=1){name1=json.data[0].RealName;headimg1="<img src='"+json.data[0].HeadImg+"'/>";}else{name1="无冠军";}
        if(json.data.length>=2){name2=json.data[1].RealName;headimg2="<img src='"+json.data[1].HeadImg+"'/>";}else{name2="无亚军";}
        if(json.data.length>=3){name3=json.data[2].RealName;headimg3="<img src='"+json.data[2].HeadImg+"'/>";}else{name3="无季军";}
        str='<div class="num1">冠军<div class="person"><div class="meng"></div><div class="name">'+name1+'</div><div class="head">'+headimg1+'</div></div></div>';
		str+='<div class="num"><div class="num2">亚军<div class="person"><div class="meng"></div><div class="name">'+name2+'</div><div class="head">'+headimg2+'</div></div></div><div class="nums"></div><div class="num3">季军<div class="person"><div class="meng"></div><div class="name">'+name3+'</div><div class="head">'+headimg3+'</div></div></div></div>';
		$(".personrank").html(str);
		
    });
};

function DepartRank_Pager(year,month) {
    var data = {};
    data.act = "Find_RankOfDepart";
    data.userid = userid;
	data.comid = comid;
	data.source = source;
	data.version = version;
    data.pageindex = 1;
    data.pagesize = 10000;
    data.year = year;
    data.month = month;
    data.sign = GetSign(data.act);
    
    $(".monthrank table").html("<tr><td colspan='4'><div class='loading'><img src='img/loading.gif'/></div></td></tr>");
    mui.getJSON(oa_domain, data, function(json) {
        var str="";
        str+='<tr><th width="15%">排名</th><th width="25%">部门</th><th width="30%">合同金额</th><th width="30%" style="text-align:right;">回款金额</th></tr>';
        $.each(json.data,function(i,info){
        	str+='<tr><td width="15%"><div class="rank'+((i+1)<4?(i+1):4)+'">'+(i+1)+'</div></td><td width="25%">'+info.DepartName+'</td><td width="30%" style="color:green;">'+info.DisMoney+'</td><td width="30%" style="text-align:right; color:green;">'+ info.ThisMonthBackMoney+'</td></tr>';
        });
        if(json.data.length==0)
        {
        	str="<tr><td colspan='4'><div class='loading'>主人，"+month+"月份销售榜单还没有产生</div></td></tr>";
        }
        $(".monthrank table").html(str);
        
        var name1="",headimg1="",name2="",headimg2="",name3="",headimg3="";
        if(json.data.length>=1){name1=json.data[0].DepartName;}else{name1="无冠军";}
        if(json.data.length>=2){name2=json.data[1].DepartName;}else{name2="无亚军";}
        if(json.data.length>=3){name3=json.data[2].DepartName;}else{name3="无季军";}
        str='<div class="num1">冠军<div class="person"><div class="departname">'+name1+'</div></div></div>';
		str+='<div class="num"><div class="num2">亚军<div class="person"><div class="departname">'+name2+'</div></div></div><div class="nums"></div><div class="num3">季军<div class="person"><div class="departname">'+name3+'</div></div></div></div>';
		$(".personrank").html(str);
    });
};

var mapcount=0;
var mapnear;
function Init_CRMPanel(classname)
{
	if(classname==".allapp"){
		FindCrmReport();
		PersonRank_Pager($("#calendar").attr("year"),$("#calendar").attr("month"));
		get("calendar").addEventListener("tap",function(){
			Show_Month(function(year,month){
				$(".monthrank .name").html(month+"月销售榜");
				$("#calendar").attr("year",year).attr("month",month);
				if($(".selectbar .select").html()=="个人"){
					PersonRank_Pager(year,month);
				}else
				{
					DepartRank_Pager(year,month);
				}
			});
		});
		mui(".selectbar").on("tap",".bar",function(){
			$(this).addClass("select").siblings().removeClass("select");
			if($(this).html()=="个人")
			{
				PersonRank_Pager($("#calendar").attr("year"),$("#calendar").attr("month"));
			}else
			{
				DepartRank_Pager($("#calendar").attr("year"),$("#calendar").attr("month"));
			}
		});
	}
	$("#contentlist0").css("background","#ececec");
	Set_Often_Menu(classname);
	mui(classname).on("tap",".line",function(){
		var tablename=$(this).attr("tablename");
							if(tablename=="客户")
							{
		      					myScroll1 = OpenScroll(1,"客户列表","<font>+</font>",function(pageindex){
										Receive_Customer(pageindex,"");
								},function(){
									OpenWindow(2,tablename,"保存",function(){
										Save_Customer();
									});
									$("#contentlist2").html(CustomerAdd_Code(0));
									Init_CustomerAdd();
								},Customer_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Customer(1,"");
								Init_Customer_Code();
							}else if(tablename=="客户查重")
							{
		      					myScroll1 = OpenScroll(1,"客户查重","",function(pageindex){
										Receive_CustomerCheck(pageindex);
								},function(){
									
								},CustomerCheck_Code(),70);
								$("#loading1").html("通过客户名称查询该客户是否已存在");
								get("find").addEventListener("tap",function(){
				      				$("#searchicon").hide();
	      							$("#searchicons").show();
	      							$("#keyword").attr("placeholder","客户名称(支持拼音)");
			    					if($("keyword").val()!="")
			    					{
			    						//WorkMate_Search();
			    					}
				      			});
							}else if(tablename=="附近客户"){
								mapcount++;
								OpenWindow4(201,"附近3km的客户","",function(){
								});
								if(mapcount==1)
								{
									$(CustomerNear_Code()).insertBefore("#contentlist201");
									$("#contentlist201").css("height",sheight-250).css("margin-top",250);
									$("#divmsg201").append('<div class="horizen border-bottom" style="top:295px;z-index:100;"></div>'); 
									Init_CustomerNear();
									
								}else
								{
									$("#contentlist201").html('<div id="loading201" class="loading"><img src="img/loading.gif"/></div>');
									mapnear.show();
								}
								Receive_CustomerNear(1);
							}else if(tablename=="公海客户")
							{
		      					myScroll1 = OpenScroll(1,"公海客户","",function(pageindex){
										Receive_CustomerHighSea(pageindex);
								},function(){
									
								},CustomerHighSea_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_CustomerHighSea(1);
								get("find").addEventListener("tap",function(){
				      				$("#searchicon").hide();
	      							$("#searchicons").show();
	      							$("#keyword").attr("placeholder","客户名称(支持拼音)，地址"); 
			    					if($("keyword").val()!="")
			    					{
			    						//WorkMate_Search();
			    					}
				      			});
							}
							else if(tablename=="销售目标")
							{
								OpenWindow2(2,"销售目标","设置",function(){
									if($("#thisyear").attr("money")=="")
									{
										return;
									}
									OpenWindow2(3,"设置目标","保存",function(){
										Set_SaleTarget();
									});
									$("#contentlist3").html(SaleTargetSet_Code());
								});
								$("#contentlist2").html(SaleTarget_Code());
								$("#button2").css("color","#666666");
								Init_SaleTarget();
							}
							else if(tablename=="联系人")
							{
		      					myScroll1 = OpenScroll(1,"联系人列表","<font>+</font>",function(pageindex){
										Receive_Contact(pageindex);
								},function(){
									OpenWindow(2,tablename,"保存",function(){
										Save_Contact();
									});
									$("#contentlist2").html(ContactAdd_Code(0));
									Init_ContactAdd(0);
								},Contact_Code(),70);
								Receive_Contact(1);
								Init_Contact_Code();
							}else if(tablename=="订单")
							{
		      					myScroll1 = OpenScroll(1,"订单列表","<font>+</font>",function(pageindex){
										Receive_Order(pageindex);
								},function(){ 
									OpenWindow(2,tablename,"保存",function(){
										Save_Order();
									});
									$("#contentlist2").html(OrderAdd_Code(0));
									Init_OrderAdd();
								},Order_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Order(1);
								Init_Order_Code();
								
							}else if(tablename=="合同")
							{
		      					myScroll1 = OpenScroll(1,"合同列表","<font>+</font>",function(pageindex){
										Receive_Contract(pageindex);
								},function(){ 
									OpenWindow(2,tablename,"保存",function(){
										Save_Contract();
									});
									$("#contentlist2").html(ContractAdd_Code(0));
									Init_ContractAdd();
								},Contract_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Contract(1);
								Init_Contract_Code();
							}else if(tablename=="产品")
							{
		      					myScroll1 = OpenScroll(1,"产品列表","<font>+</font>",function(pageindex){
										Receive_Product(pageindex);
								},function(){
									OpenWindow(2,tablename,"保存",function(){
										Save_Product();
									});
									$("#contentlist2").html(ProductAdd_Code(0));
									Init_ProductAdd();
								},Product_Code(),70);
								Receive_Product(1);
								Init_Product_Code();
							}else if(tablename=="库存")
							{
		      					myScroll1 = OpenScroll(1,"库存列表","<font>+</font>",function(pageindex){
										Receive_Inventory(pageindex);
								},function(){ 
									OpenWindow(2,"采购订单","保存",function(){
										Save_Purchase();
									});
									$("#contentlist2").html(PurchaseAdd_Code(0,"inventory",1));
									Init_PurchaseAdd();
								},Inventory_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Inventory(1);
								Init_Inventory_Code();
							}else if(tablename=="采购管理")
							{
		      					myScroll1 = OpenScroll(1,"采购列表","<font>+</font>",function(pageindex){
										Receive_Purchase(pageindex);
								},function(){
									PurchaseAddTool();
								},Purchase_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Purchase(1);
								Init_Purchase_Code();
							}else if(tablename=="调拨")
							{
		      					myScroll1 = OpenScroll(1,"调拨列表","<font>+</font>",function(pageindex){
										Receive_Movement(pageindex);
								},function(){ 
									OpenWindow(2,"调拨","保存",function(){
										Save_Movement();
									});
									$("#contentlist2").html(MovementAdd_Code(0,"inventory",1));
									Init_MovementAdd();
								},Movement_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Movement(1);
								Init_Movement_Code();
								
							}else if(tablename=="库位")
							{
		      					myScroll1 = OpenScroll(1,"库位列表","<font>+</font>",function(pageindex){
										Receive_Library(pageindex);
								},function(){ 
									OpenWindow(2,"库位","保存",function(){
										Save_Library();
									});
									$("#contentlist2").html(LibraryAdd_Code(0,"inventory",1));
									Init_LibraryAdd();
								},Library_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Library(1);
								get("find").addEventListener("tap",function(){
				      				$("#searchicon").hide();
	      							$("#searchicons").show();
	      							$("#keyword").attr("placeholder","仓库编号，仓库名称"); 
			    					if($("keyword").val()!="")
			    					{
			    						//WorkMate_Search();
			    					}
				      			});
							}else if(tablename=="供应商")
							{
		      					myScroll1 = OpenScroll(1,"供应商列表","<font>+</font>",function(pageindex){
										Receive_Supplier(pageindex);
								},function(){ 
									OpenWindow(2,"供应商","保存",function(){
										Save_Supplier();
									});
									$("#contentlist2").html(SupplierAdd_Code(0,"inventory",1));
									Init_SupplierAdd();
								},Supplier_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Supplier(1);
								get("find").addEventListener("tap",function(){
				      				$("#searchicon").hide();
	      							$("#searchicons").show();
	      							$("#keyword").attr("placeholder","仓库编号，仓库名称"); 
			    					if($("keyword").val()!="")
			    					{
			    						//WorkMate_Search();
			    					}
				      			});
							}else if(tablename=="添加应用")
							{
								OpenWindow2(2,"添加应用","",function(){
								});
								$("#contentlist2").html("");
								addcrm.removeClass("hidden");
								$("#contentlist2").append(addcrm);
								
							}
	});
};
